public class RPG2
{
    public static void main (String[] args)
    {
        SwordsMan swordsMan = new SwordsMan();
        swordsMan.setName("Justin");
        swordsMan.setLevel(1);
        swordsMan.setBlood(200);

        Magician magician = new Magician();
        magician.setName("Moinca");
        magician.setLevel(1);
        magician.setBlood(100);

        showBlood(swordsMan);   //SwordsMan是一种Role
        showBlood(magician);
    }
    static void showBlood(Role role)   //声明为Role类型
    {
        System.out.printf("%s 血量 %d%n",role.getName(), role.getBlood());
    }
}